<style lang="scss" scoped>
</style>

<template>
  <el-dialog v-model="visible" title="查看物流信息" @close="handleClose" style="width: 450px;">
    <div class="modal_content">
        <el-timeline>
            <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.timestamp" :color="activity.color">{{ activity.content }} </el-timeline-item>
        </el-timeline>
    </div>
    <template #footer>
      <div class="modal-btn-list">
        <div>
          <el-button type="primary" @click="handleClose">关闭</el-button>
        </div>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref } from "vue";
import {postDeliverFindLogiInfo} from "@/api/deliveryOrder.js"
// import purchaseManage from "@/api/purchaseManage";
// import { getCode } from "@/utils/index.js";

const visible = ref(false);
const loading = ref(false);
// 控制是否禁用
const isDisabled = ref(false);
const activities = ref([]);
const shippingOrderNumber = ref("")


onMounted(()=>{

})

// 打开
const getParent = async (type) => {
  console.log(type);
  shippingOrderNumber.value = type
  activities.value = []
  const res = await postDeliverFindLogiInfo({shippingOrderNumber: shippingOrderNumber.value})
  res.data.companyLogiDtos.forEach(item => {
    activities.value.push({
      content: item.address,
      timestamp: item.createTime,
      color: '#1E90FF'
    })
  })
  isDisabled.value = false;
  visible.value = true;

};
// 关闭
const handleClose = () => {
  visible.value = false;
  // location.reload();
};


defineExpose({
  getParent,
});
</script>
